/** Code Eval::Moderate [Pangrams]
 *	Pangram - sentence which contains all leters of the alphabet
 *	Determine if a sentence is an pangram
 *	Output: 
 *		NULL if pangram
 *		missing leters in lowercase if not pangram (alphabetical order)
 *
 *	by Michael Pio Arroyo
 */
#include <iostream>
#include <fstream>
#include <string>
#include <vector>

#define SOA 26	// size of alphabet

class pangram;

int main(int argc, char** argv) {
	std::ifstream file;
	std::string line;
	std::string::iterator it;
	file.open("test.txt");

	while (getline(file, line)) {
		std::vector<char> sentence;
		pangram pan;
		for (it = line.begin(); it != line.end(); ++it) {
			if (*it != ' ') {
				pan.check(*it);
			}
		}
		pan.isPangram();
		putchar('\n');
	}

	file.close();
	return 0;
}

struct alph {
	char name;
	bool exists;
};

class pangram {
public:
	pangram() {
		createAlphabedList();
	}
	~pangram() {}

	bool isPangram() {
		bool exists = false;
		for (int i = 0; i < SOA; ++i) {
			if (m_list.at(i).exists == true) {
				putchar(m_list.at(i).name);
				exists = true;
			}
		}
		if (exists)
			return true;
		std::cout << "NULL";
		return false;
	}

	/** Check if *it == pan.name
	*	@return true if match found
	*/
	bool check(char a_c) {
		if (m_list.size() != SOA) {
			std::cout << "m_list not allocated";
			return false;
		}

		for (int i = 0; i < SOA; ++i) {
			if (m_list.at(i).name == a_c) {
				m_list.at(i).exists = true;
				return true;
			}
		}
		return false;
	}

	void createAlphabedList() {
		for (int i = 0; i < SOA; ++i) {
			alph t;
			t.exists = false;
			m_list.push_back(t);
		}
		m_list.at(0).name = 'a';
		m_list.at(1).name = 'b';
		m_list.at(2).name = 'c';
		m_list.at(3).name = 'd';
		m_list.at(4).name = 'e';
		m_list.at(5).name = 'f';
		m_list.at(6).name = 'g';
		m_list.at(7).name = 'h';
		m_list.at(8).name = 'i';
		m_list.at(9).name = 'j';
		m_list.at(10).name = 'k';
		m_list.at(11).name = 'l';
		m_list.at(12).name = 'm';
		m_list.at(13).name = 'n';
		m_list.at(14).name = 'o';
		m_list.at(15).name = 'p';
		m_list.at(16).name = 'q';
		m_list.at(17).name = 'r';
		m_list.at(18).name = 's';
		m_list.at(19).name = 't';
		m_list.at(20).name = 'u';
		m_list.at(21).name = 'v';
		m_list.at(22).name = 'w';
		m_list.at(23).name = 'x';
		m_list.at(24).name = 'y';
		m_list.at(25).name = 'z';
	}
private:
	std::vector<alph> m_list;
};